/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.vijay.mvnbuilddownload;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
 *
 * @author elangovanv
 */

/*
 <snapshot>
<timestamp>20101215.010239</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
 */
public class MetadataVersioningSnapshot {
    private String timestamp;
    private String buildNumber;

    private NodeList nodeList;
    
    public MetadataVersioningSnapshot(NodeList nodeList) {
        this.nodeList=nodeList;
    }

    public void parse() {
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node node = nodeList.item(i);
            
            if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("timestamp")) {
                this.timestamp=node.getTextContent();                
            } else if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("buildNumber")) {
                this.buildNumber=node.getTextContent();
            }
        }
    }

    public String getBuildNumber() {
        return buildNumber;
    }

    public void setBuildNumber(String buildNumber) {
        this.buildNumber = buildNumber;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public String toString() {
        return "MetadataVersioningSnapshot{" + "timestamp=" + timestamp + "buildNumber=" + buildNumber+'}';
    }
    
}
